home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / alynx / goodies / mosaic_shunt.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-10  |  4KB  |  129 lines

  1. /*
  2.  * From peterh@dialup26.geko.com.auWed Jun  7 17:25:39 1995
  3.  * Date: Tue, 6 Jun 95 20:10:13 
  4.  * From: Peter Hanrahan <peterh@dialup26.geko.com.au>
  5.  * Reply to: Peter Hanrahan <peterh@geko.com.au>
  6.  * To: wwwutz@cha01.tfh-berlin.de
  7.  * Subject: Re: Alynx 1.20
  8.  * 
  9.  * Odd, it checked out OK at this end.. Anyway, here's the raw rexx file for
  10.  * you.
  11.  * 
  12.  * Peter
  13.  * 
  14.  * 
  15.  * Mosaic_Shunt.rexx
  16.  * -------------------------------------------------------------------------
  17.  */
  18.  
  19. /*
  20.  Mosaic_Shunt. This is the new and improved Mosaic Shunt, after having
  21.  layed around unattended to for awhile.
  22.  As with the first Shunt, it's open to improvement by anyone else,
  23.  hence I call it ImproveWare, yet remains (c) Copyright 1995 by Aaron Weiss
  24.  
  25. This version is modified by Peter Hanrahan to work better with Alynx  */
  26.  
  27. /*---------------------------------------------------------------------------*/
  28. /*User definable variables - edit these for your particular system           */
  29.  
  30. savemode=2 /*1=Never Save, 2=Option w/Reqestor, 3=Always save, no req.       */
  31. savedrawer='DL:'     /*Set this string to the default drawer for saving */
  32.                           /*although you can change this in the file req.    */
  33. /*---------------------------------------------------------------------------*/
  34. /*That's it, no more user definable variables. Suffer.*/
  35. /*Venture below this point at your own risk!*/
  36.  
  37.  
  38. Parse ARG 1 filename viewer
  39.  
  40.  
  41. /*i = index(viewer, 'NULL')
  42.  
  43. if i > 0 then viewer = word(viewer,1)||' '||filename */
  44.  
  45. viewer = viewer||' '||filename
  46.  
  47.  
  48.  
  49. /*Let's figure out what screen Amiga Mosaic is running on*/
  50.  
  51. Call open infile,"env:mui/amigamosaic.prefs"
  52. pubtmp=''
  53. Do until (EOF(infile))
  54.  inline=readln(infile)
  55.  if pos('xBYx',inline)~=0 then pubtmp=inline
  56. end
  57. close(infile)
  58.  
  59. if pubtmp~='' then pubscreen=right(pubtmp,(length(pubtmp)-pos('xBYx',pubtmp))-4) 
  60.               else pubscreen=''         
  61.  
  62. q = index(SHOW(P),'AMOSAIC')
  63. if q = 0 then pubscreen=''         
  64. say q
  65.  
  66.  
  67. /*First we need to create the commandline with filename in place of %s*/
  68.  
  69. filepos=1
  70. DO UNTIL filepos=0 
  71.  filepos=INDEX(viewer,"%s")
  72.  If filepos>0 Then 
  73.   DO
  74.    cmd1=LEFT(viewer,(filepos-1))
  75.    cmd2=RIGHT(viewer,LENGTH(viewer)-(filepos+1))
  76.    viewer=cmd1||filename||cmd2
  77.   END 
  78. END 
  79.  
  80. /*Execute the viewer, and show pretty picture, or mellifluous melody, etc.*/
  81.  
  82. address command viewer
  83.                
  84.  
  85. /*And in the following mess we go about preparing to save the file, or not, */
  86. /*depending on the user setting at the top of this file*/
  87.  
  88. If savemode>1 Then 
  89. DO
  90. SaveFile=filename
  91. Mark=LASTPOS("/",SaveFile)
  92. If Mark==0 Then 
  93.  Mark=LASTPOS(":",SaveFile)
  94. If Mark>0 Then 
  95.   SaveFile=Right(SaveFile,LENGTH(SaveFile)-Mark)
  96.  
  97. filed=0
  98. If savemode=2 Then
  99. DO
  100.  if pubscreen~='' then cmdstring='requestfile DRAWER '||savedrawer||' FILE '||SaveFile||' TITLE "Save This Gem Where?" PUBSCREEN '||pubscreen||' > t:savefile'
  101.   else cmdstring='requestfile DRAWER '||savedrawer||' FILE '||SaveFile||' TITLE "Save This Gem Where?" > t:savefile'
  102.  
  103.  address command cmdstring
  104.  filed=rc
  105.  
  106.  if filed=0 then 
  107.   DO
  108.    SaveFile=''     
  109.    open(infile, 't:savefile')       
  110.     do until (eof(infile))
  111.      SaveFile = SaveFile||(readln(infile))
  112.     end 
  113.    close(infile)       
  114.   END     
  115. END 
  116.  
  117.  Else SaveFile=savedrawer ||'/'||SaveFile        
  118.   
  119.  /*After all the above rigamarole, we've either got a filename to save to by now, */
  120.  /*or else we've dropped out some time ago. So save it, McCloud. */
  121.  
  122.  if filed=0 then address command 'copy '||filename||' '||savefile
  123.  if (filed=0)&(savemode=2) then address command 'delete t:savefile >nil:'   
  124.  
  125. END
  126. /*Yay! Let Mosaic Or ALynx have you back again. They miss you.*/
  127. exit
  128.  
  129.